【Clojureでゼロから作るDeep Learning】 2章 パーセプトロン
2.1 パーセプトロンとは
2.2 単純な論理回路
2.2.1 ANDゲート
2.2.2 NANDゲートとORゲート
2.3 パーセプトロンの実装
2.3.1 簡単な実装
code:clojure
(let [w1 0.5
w2 0.5
theta 0.7
tmp (+ (* x1 w1)
(* x2 w2))]
(if (<= tmp theta) 0 1)))
user> (AND 0 0)
0
user> (AND 1 0)
0
user> (AND 0 1)
0
user> (AND 1 1)
1
2.3.2 重みとバイアスの導入
code:clojure
nil
user> (m/set-current-implementation :clatrix)
:clatrix
user> (let [x (m/array 0 1) b -0.7]
(m/mul w x))
(0.0 0.5)
user> (let [x (m/array 0 1) b -0.7]
(m/add (m/esum (m/mul w x))
b))
-0.19999999999999996
2.3.3 重みとバイアスによる実装
code:clojure
b -0.7
tmp (m/add (m/esum (m/mul w x))
b)]
(if (<= tmp 0) 0 1)))
(0 0 0 1)
b 0.7
tmp (m/add (m/esum (m/mul w x))
b)]
(if (<= tmp 0) 0 1)))
(1 1 1 0)
b -0.2
tmp (m/add (m/esum (m/mul w x))
b)]
(if (<= tmp 0) 0 1)))
(0 1 1 1)
2.4 パーセプトロンの限界
2.4.1 XORゲート
2.4.2 線形と非線形
2.5 多層パーセプトロン
2.5.1 既存ゲートの組み合わせ
2.5.2 XORゲートの実装
code:clojure
(let [s1 (NAND x1 x2)
s2 (OR x1 x2)]
(AND s1 s2)))
(0 1 1 0)
2.6 NANDからコンピュータへ
2.7 まとめ